/* 设置cookie */
const Koa = require('koa');
const app = new Koa();

app.use(async (ctx, next)=>{
	if (ctx.url === '/index') {
		ctx.cookies.set(
			'MyName','CJTY'
		);
		ctx.body = 'cookie is ok';
	} else {
		ctx.body = 'cookie is xiaopao';
	}
})

app.listen(3000, () => {
	console.log('[demo] server is starting at port 3000');
})